﻿<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
  <head>
  <base href="<%=basePath%>">
    <title>updateSelectGoods.jsp</title>
	<link rel="stylesheet" href="${pageContext.request.contextPath}/css/bootstrap.min.css">
	<style type="text/css">
		/*table{
			text-align: center;
			border-collapse: collapse;
		}*/
		.bgcolor{
		  	background-color: #ddd;
		}
	</style>
	<script type="text/javascript">
		function changeColor(obj){
			obj.className = "bgcolor";
		}
		function changeColor1(obj){
			obj.className = "";
		}
	</script>
</head>
<body>
    <div align="center">
	<c:if test="${allGoods.size() == 0 }">
		您还没有商品。
	</c:if>
	<c:if test="${allGoods.size() != 0 }">
		<div style="width: 100%; text-align: center;font-weight: bold;font-size: 20px; padding: 10px;">商品列表</div>
		<table class="table table-condensed" style="width: 80%;">
			<tr>
				<th width="100px">#</th>
				<th width="200px">名称</th>
				<th width="200px">价格</th>
				<th width="100px">库存</th>
				<th width="100px">详情</th>
				<th width="100px">操作</th>
			</tr>
			<c:forEach items="${allGoods }" var="goods">
				<tr onmousemove="changeColor(this)" onmouseout="changeColor1(this)">
					<td>${goods.id }</td>
					<td>${goods.gname }</td>
					<td>${goods.grprice }</td>
					<td>${goods.gstore }</td>
					<td><a href="goods/selectAGoods?id=${goods.id }" class="btn btn-primary">详情</a></td>
					<td><a href="goods/selectAGoods?id=${goods.id }&act=updateAgoods" target="center" class="btn btn-warning">修改</a></td>
				</tr>
			</c:forEach>
			
		</table>
	</c:if>
	</div>
	<div align="center">
		共<font style="font-weight: bold;">${totalCount }</font>条记录&nbsp;&nbsp;共<font style="font-weight: bold;">${totalPage }</font>页&nbsp;&nbsp;第<font style="font-weight: bold;">${pageCur }</font>页<br>
		<c:url var="url_pre" value="goods/selectGoods">
			<c:param name="pageCur" value="${pageCur - 1 }"/>
			<c:param name="act" value="updateSelect"/>
		</c:url>
		<c:url var="url_next" value="goods/selectGoods">
			<c:param name="pageCur" value="${pageCur + 1 }"/>
			<c:param name="act" value="updateSelect"/>
		</c:url>
		<ul class="pager">
			<li>
				<!-- 第一页没有上一页 -->
				<c:if test="${pageCur != 1 }">
					<a href="${url_pre}">上一页</a>&nbsp;&nbsp;&nbsp;&nbsp;
				</c:if>
			</li>
			<li>
				<!-- 最后一页，没有下一页 -->
				<c:if test="${pageCur != totalPage && totalPage != 0}">
					<a href="${url_next}">下一页</a>
				</c:if>
			</li>
		</ul>
	</div>
</body>
</html>